package com.it.gmall.all.controller;

import com.it.gmall.item.client.ItemFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.HashMap;
import java.util.Map;

/**
 * 商品详情
 */
@Controller
public class ItemController {
    @Autowired
    private ItemFeignClient itemFeignClient;

    @GetMapping("/{skuId}.html")
    public String getItem(@PathVariable long skuId, Map map){
        Map result = itemFeignClient.getItem(skuId);
        map.putAll(result);
        return "item/index";
    }
}
